home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / gamma-bros.swf / scripts / __Packages / classes / fx / AsteroidB.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  2.1 KB  |  74 lines

  1. class classes.fx.AsteroidB
  2. {
  3.    var size;
  4.    var id;
  5.    var x;
  6.    var y;
  7.    var dir;
  8.    var colorV;
  9.    var clip;
  10.    var xMov;
  11.    var yMov;
  12.    var yank;
  13.    var sizeArray = [[1,3],[4,9],[10,17],[18,23],[24,27]];
  14.    var Name = "asteroidB";
  15.    function AsteroidB(px, py, psize, pdir, pcolorV, pid)
  16.    {
  17.       this.size = psize;
  18.       this.id = pid;
  19.       this.x = px;
  20.       this.y = py;
  21.       this.dir = pdir;
  22.       this.colorV = pcolorV;
  23.       _root.d = _root.d + 1;
  24.       if(_root.level == 3)
  25.       {
  26.          this.clip = _root.attachMovie("asteroidC","asteroidB" + this.id + "Clip",_root.d - 4000);
  27.       }
  28.       else
  29.       {
  30.          this.clip = _root.attachMovie("asteroidB","asteroidB" + this.id + "Clip",_root.d - 4000);
  31.       }
  32.       this.clip.gotoAndStop(this.colorV);
  33.       this.clip.body.gotoAndStop(_root.randRange(this.sizeArray[this.size - 1][0],this.sizeArray[this.size - 1][1]));
  34.       if(this.dir == "U")
  35.       {
  36.          this.xMov = _root.randRange2(this.size - 5,-1 * (this.size - 5));
  37.          this.yMov = _root.randRange2(this.size - 5,0.5);
  38.       }
  39.       else if(this.dir == "D")
  40.       {
  41.          this.xMov = _root.randRange2(this.size - 5,-1 * (this.size - 5));
  42.          this.yMov = _root.randRange2(0.5,-1 * (this.size - 9));
  43.       }
  44.       else if(this.dir == "L")
  45.       {
  46.          this.xMov = _root.randRange2(this.size - 5,0.5);
  47.          this.yMov = _root.randRange2(this.size - 5,-1 * (this.size - 5));
  48.       }
  49.       else
  50.       {
  51.          this.xMov = _root.randRange2(0.5,-1 * (this.size - 5));
  52.          this.yMov = _root.randRange2(this.size - 5,-1 * (this.size - 5));
  53.       }
  54.       this.clip._x = this.x;
  55.       this.clip._y = this.y;
  56.       this.clip._rotation = random(4) * 90;
  57.    }
  58.    function main()
  59.    {
  60.       if(this.x > 1150 || this.x < -150 || this.y < -150 || this.y > 750)
  61.       {
  62.          this.yank = true;
  63.       }
  64.       if(this.yank)
  65.       {
  66.          _root.removeFX("asteroidB" + this.id);
  67.       }
  68.       this.x += this.xMov;
  69.       this.y += this.yMov;
  70.       this.clip._x = this.x;
  71.       this.clip._y = this.y;
  72.    }
  73. }
  74.